package com.bookmanager.www.service;

import com.bookmanager.www.entity.mongodb.MemberReadHistory;
import org.springframework.data.mongodb.repository.MongoRepository;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @author: 风离
 * @Date: 2021/12/09/23:05
 * @Description: 会员商品浏览历史Repository
 */
public interface MemberReadHistoryRepository extends MongoRepository<MemberReadHistory, String> {

    /**
     * 根据会员id按时间倒序获取浏览记录
     * @param memberId
     * @return
     */
    List<MemberReadHistory> findByMemberIdOrderByCreateTimeDesc(Long memberId);


    /**
     * 根据商品id查询浏览记录
     * @param bookId
     * @return
     */
    MemberReadHistory findByBookId(Long bookId);

//    /**
//     * 根据会员id按时间倒序获取浏览记录
//     * @param memberId
//     * @return
//     */
//    List<MemberReadHistory> findMemberReadHistoryByMemberIdOrderByCreateTimeDesc(Long memberId);


}
